/**
 * 
 */
package com.edocbase.desktop.plugins.mdairy.catalog.ui;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

import com.edocbase.biz.diary.entities.DiaryEntity;
import com.edocbase.biz.diary.entities.IDiary;

/**
 * @author X61
 *
 */
public class DiaryLabelProvider extends LabelProvider implements ITableLabelProvider{

	@Override
	public Image getImage(Object element) {
		return super.getImage(element);
	}

	@Override
	public String getText(Object element) {
		if (element instanceof DiaryEntity){
			IDiary entity = (IDiary)element;
			if (entity.getTitle() != null){
				return entity.getTitle();
			}
		}
		return super.getText(element);
	}

	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		if (element instanceof DiaryEntity){
			IDiary entity = (IDiary)element;
			if (columnIndex ==1){
				return entity.getTitle();
			}
		}
		return null;
	}

}
